package cn.xcyy.itcc.feign;

import cn.xcyy.itcc.domain.Login;
import cn.xcyy.itcc.enums.GlodalErrorCode;
import cn.xcyy.itcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LonginFeignClientFallbackFactory implements FallbackFactory<LonginFeignClient> {

    @Override
    public LonginFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new LonginFeignClient() {
            @Override
            public JSONResult saveOrUpdate(Login login) {
                return JSONResult.error(GlodalErrorCode.SERVICE_ERROR);
            }
        };
    }
}